﻿namespace CodingExercises._41_50;

public class TemperatureConverter
{
    // 使用表达式体成员定义温度转换器
    private double _kelvin;

    public TemperatureConverter(double kelvin) => _kelvin = kelvin;

    public double Kelvin => _kelvin;

    public double Celsius
    {
        get => _kelvin - 273.15;
        set => _kelvin = value + 273.15;
    }

    public double ToFahrenheit() => (_kelvin - 273.15) * 9 / 5 + 32;
}